package com.fare.taluo.core.domain.crawl.impl;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.dayatang.domain.DataPage;
import com.dayatang.hibernate.EntityRepositoryHibernate;
import com.fare.taluo.util.DateUtils;
import com.fare.taluo.util.SpringUtil;
import com.fare.taluo.util.StringAndDateAndFileUtil;
import com.fare.taluo.core.domain.crawl.TaskQueueLogEntity;
import com.fare.taluo.core.domain.crawl.TaskQueueLogEntityRepository;
import com.fare.taluo.core.domain.crawl.statistics.StatisticsTotalDetailEntity;
import com.fare.taluo.core.domain.crawl.statistics.StatisticsTotalEntity;

@Repository
public class TaskQueueLogEntityRepositoryImpl extends EntityRepositoryHibernate implements
		TaskQueueLogEntityRepository {
	
	private SessionFactory sessionFactory;

	private JdbcTemplate jdbctemp=(JdbcTemplate) SpringUtil.getBean("jdbcTemplate");
	
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	//分页查出一定数据
	@Override
	public List<TaskQueueLogEntity> getTaskRecordList(String fromCityOrg,String toCityOrg,
			String grabchannelID,Date startTime,Date endTime,String status,String sortorder,String sortname,
			int page,int pagesize) {
		StringBuffer sbf=new StringBuffer("from TaskQueueLogEntity a where 1=1 ");
		List<Object> list = new ArrayList<Object>();
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		
		if (StringAndDateAndFileUtil.checkString(fromCityOrg)) {
			sbf.append(" and a.fromCity = '"+fromCityOrg+"'");
		}
		
		if (StringAndDateAndFileUtil.checkString(toCityOrg)) {
			sbf.append(" and  a.toCity = '"+toCityOrg+"'");
		}
		
		if(StringAndDateAndFileUtil.checkString(grabchannelID)){
			sbf.append(" and  a.grabchannelID = '"+Long.parseLong(grabchannelID)+"'");
		}
		
		if (startTime != null&&endTime != null) {
			sbf.append(" and  a.createTime between " +
					   " str_to_date('"+df.format(startTime)+"','yyyy-MM-dd')" +
			     " and   str_to_date('"+df.format(endTime)+"','yyyy-MM-dd')+1");
		}

		if (StringAndDateAndFileUtil.checkString(status)) {
			Long statuNum=Long.parseLong(status);
			sbf.append(" and a.status = '"+statuNum+"'");
		}
		
		/*if(StringUtils.isNotBlank(sortorder) && StringUtils.isNotBlank(sortname)){
			if(StringUtils.equalsIgnoreCase(sortname, "leg")){
				sortname="fromCity";
			}
			sbf.append(" order by "+sortname+" "+sortorder+"");
		}*/
		
		DataPage<TaskQueueLogEntity> pageNum = find(sbf.toString(), new Object[]{}, page, pagesize,com.fare.taluo.core.domain.crawl.TaskQueueLogEntity.class);
		List<TaskQueueLogEntity> lists =pageNum.getPageData();
		return lists;
	}
	
	
	
	//得到条件查询 总记录数
	@Override
	public int getTotalTaskRecordListByCodition(String fromCityOrg,
			String toCityOrg, String grabchannelID, Date startTime, Date endTime,
			String status) {
		StringBuffer sbf=new StringBuffer("from TaskQueueLogEntity a where 1=1 ");
		List<Object> list = new ArrayList<Object>();
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		if (StringAndDateAndFileUtil.checkString(fromCityOrg)) {
			sbf.append(" and a.fromCity = '"+fromCityOrg+"'");
		}
		if (StringAndDateAndFileUtil.checkString(toCityOrg)) {
			sbf.append(" and  a.toCity = '"+toCityOrg+"'");
		}
		
		if(StringAndDateAndFileUtil.checkString(grabchannelID)){
			sbf.append(" and  a.grabchannelID = '"+Long.parseLong(grabchannelID)+"'");
		}
		
		if (startTime != null && endTime != null) {
			sbf.append(" and  a.createTime between " +
					   " str_to_date('"+df.format(startTime)+"','yyyy-MM-dd')" +
			     " and str_to_date('"+df.format(endTime)+"','yyyy-MM-dd')+1");
		}
		if (StringAndDateAndFileUtil.checkString(status)) {
			Long statuNum=Long.parseLong(status);
			sbf.append(" and a.status = '"+statuNum+"'");
		}
		List<TaskQueueLogEntity> lists =super.find(sbf.toString(),list.toArray(),com.fare.taluo.core.domain.crawl.TaskQueueLogEntity.class);
		return lists.size();
	}

	
	@Override
	public TaskQueueLogEntity getTaskRecordByCondition(String fromCityOrg,String toCityOrg,Date startTime,Date endTime,String status) {
		String condition = "";
		String a = "from TaskQueueLogEntity a where 1=1";
		List<Object> list = new ArrayList<Object>();
		if (fromCityOrg != null) {
			condition = condition + " and a.toCity = ?";
			list.add(fromCityOrg);
		}
		if (toCityOrg != null) {
			condition = condition + " and  a.toCity = ?";
			list.add(toCityOrg);
		}
		if (startTime != null) {
			condition = condition + " and  a.startTime = ?";
			list.add(startTime);
		}
		if (endTime != null) {
			condition = condition + " and  a.endTime = ?";
			list.add(endTime);
		}
		if (status != null) {
			condition = condition + " and a.status = ?";
			list.add(status);
		}
		a += condition;
		TaskQueueLogEntity re = super.getSingleResult(a, list.toArray(),
				TaskQueueLogEntity.class);
		return re;
	}
	public List<TaskQueueLogEntity> getTaskRecordByGDate(Date beginTime,Date endTime,String grabchannel,String status){
		String condition = "";
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String bt = df.format(beginTime);
		String hql = "from TaskQueueLogEntity a where 1=1 and a.status = '"+status+"'";
		condition = condition + " and str_to_date(replace(a.startTime,'月',''),'dd-MM-yy') = str_to_date('"+bt+"','yyyy-MM-dd') and a.grabChannel = ?";
		List<Object> list = new ArrayList<Object>();
		list.add(grabchannel);
		hql +=condition;
		List<TaskQueueLogEntity> lists = this.find(hql,list.toArray(),TaskQueueLogEntity.class);
		return lists;
	}



	@Override
	public List<TaskQueueLogEntity> getTaskRecordByNowDate(Date nowDate) {
		String hql =  "from TaskQueueLogEntity a where 1=1";
		nowDate.setMinutes(0);
		nowDate.setSeconds(0);
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		List<Object> list = new ArrayList<Object>();
		//String bt = "2013-02-21 17";
		String bt=df.format(nowDate);
		hql+=" and to_char(a.startTime,'yyyy-MM-dd hh24') = '"+bt+"'";
		return this.find(hql,list.toArray(),TaskQueueLogEntity.class);
	}


	//引擎统计使用
	@Override
	public List<TaskQueueLogEntity> getTaskRecordByDateAndChannel(
			Date grabdate, String grabchannelID,String status,int page,int pagesize) {
		//引擎统计中的时间  只有年月日，所以查失败详细信息时，时间只能通过模糊查询
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
//		String hql = "from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		String hql = "from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		Long statuNum=Long.parseLong(status);
		hql+=" and a.status = '"+status+"' order by flightDate,fromCityName,toCityName";
		DataPage<TaskQueueLogEntity> pageNum = find(hql, new Object[]{}, page, pagesize,TaskQueueLogEntity.class);
		List<TaskQueueLogEntity> lists =pageNum.getPageData();
		return lists;
	}
	//引擎统计使用  TOtal  getTotalRecordByDateAndChannel
	public List<TaskQueueLogEntity> getTotalRecordByDateAndChannel(
			Date grabdate, String grabchannelID,String status,String fromCity,String toCity,int page,int pagesize) {
		//引擎统计中的时间  只有年月日，所以查失败详细信息时，时间只能通过模糊查询
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
//		String hql = "from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		String hql = "from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		Long statuNum=Long.parseLong(status);
		hql+=" and a.status = '"+status+"' and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flightDate,fromCityName,toCityName";
		DataPage<TaskQueueLogEntity> pageNum = find(hql, new Object[]{}, page, pagesize,TaskQueueLogEntity.class);
		List<TaskQueueLogEntity> lists =pageNum.getPageData();
		return lists;
	}
	//引擎统计——总数  
	public List<StatisticsTotalDetailEntity> getTotalAllByFromAndTo(
			String grabdate, String grabchannelID,String fromCity,String toCity) {
		//引擎统计中的时间  只有年月日，所以查失败详细信息时，时间只能通过模糊查询
//		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//		String time=df.format(grabdate);
//		String hql = "from StatisticsTotalDetailEntity a where to_char(a.grabdate,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
//		hql+=" and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flight_date,from_city_name,to_city_name";
//		List<StatisticsTotalDetailEntity> lists = new ArrayList<StatisticsTotalDetailEntity>();
//		lists=this.find(hql,lists.toArray(),StatisticsTotalDetailEntity.class);
		
		List<StatisticsTotalDetailEntity> lists =new ArrayList<StatisticsTotalDetailEntity>();
		Session session=null;
		try {
			session =sessionFactory.openSession();
			session.beginTransaction();
			SQLQuery sqlQuery=session.createSQLQuery("{Call STATISTICS_TOTAL_DETAIL_PRO(?,?,?,?)}");
			sqlQuery.setString(0, grabdate);
			sqlQuery.setString(1, grabchannelID);
			sqlQuery.setString(2, fromCity);
			sqlQuery.setString(3, toCity);
			lists=QueryBy1(sqlQuery.list());
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return lists;
	}
	
	private List<StatisticsTotalDetailEntity> QueryBy1(List list) {
		List<StatisticsTotalDetailEntity> lists = new ArrayList<StatisticsTotalDetailEntity>();
		for (int i = 0; i < list.size(); i++) {
			StatisticsTotalDetailEntity ste = new StatisticsTotalDetailEntity();
			Object[] row = (Object[]) list.get(i);
			if(row[3]==null||row[3].toString().equals("")){
				continue;
			}
			ste.setId(row[0].toString());
			ste.setGrabchannelID(Long.parseLong(row[1].toString()));
			ste.setGrabchannel(row[2].toString());
			ste.setFlightdate(row[3].toString());
			ste.setCreatedate(row[4].toString());
			ste.setGrabdate(row[5].toString());
			ste.setFromCity(row[6].toString());
			ste.setFromCityName(row[7].toString());
			ste.setToCity(row[8].toString());
			ste.setToCityName(row[9].toString());
			ste.setMinTime(Long.parseLong(row[10].toString()));
			ste.setMaxTime(Long.parseLong(row[11].toString()));
			ste.setSuccessNum(Long.parseLong(row[12].toString()));
			ste.setFailNum(Long.parseLong(row[13].toString()));
			ste.setStatus(Long.parseLong(row[14].toString()));
			ste.setAllbyteLength(Long.parseLong(row[15].toString()));
			ste.setSourceDataSize(Long.parseLong(row[16].toString()));
			ste.setStartTime((Date) row[17]);
			ste.setEndTime((Date) row[18]);
			lists.add(ste);
		}
		return lists;
	}
	
	//getTotalAllByFromAndTo
	public int getTotalCountByFromAndTo(Date grabdate, String grabchannelID,String fromCity,String toCity) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
		String hql="from StatisticsTotalDetailEntity a where to_char(a.grabdate,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		hql+=" and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flight_date,from_city_name,to_city_name";
		List<StatisticsTotalDetailEntity> list = new ArrayList<StatisticsTotalDetailEntity>();
		list=this.find(hql,list.toArray(),StatisticsTotalDetailEntity.class);
		return list.size();
	}
		
	
	
	
	//引擎统计中点击  总数使用 getTotalRecordByDateAndChannel	
	public List<StatisticsTotalEntity> getTotalRecordByDateAndChannel(String grabdate, String grabchannelID) {
//		//引擎统计中的时间  只有年月日，所以查失败详细信息时，时间只能通过模糊查询
//		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//		String time=df.format(grabdate);
//		String hql = "from StatisticsTotalEntity a where to_char(a.grabdate,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
////		Long statuNum=Long.parseLong(status);
////		hql+=" and a.status = '"+status+"' order by flightDate,fromCityName,toCityName";
//		hql+=" order by fromCityName,toCityName";
////		DataPage<StatisticsTotalEntity> pageNum = find(hql, new Object[]{}, StatisticsTotalEntity.class);
////		List<StatisticsTotalEntity> lists =pageNum.getPageData();
//		List<StatisticsTotalEntity> lists =new ArrayList<StatisticsTotalEntity>();
//		lists=this.find(hql,lists.toArray(),StatisticsTotalEntity.class);
		List<StatisticsTotalEntity> lists =new ArrayList<StatisticsTotalEntity>();
		Session session=null;
		try {
			session =sessionFactory.openSession();
			session.beginTransaction();
			SQLQuery sqlQuery=session.createSQLQuery("{Call STATISTICS_TOTAL_PRO(?,?)}");
			sqlQuery.setString(0, grabdate);
			sqlQuery.setString(1, grabchannelID);
			lists=QueryBy(sqlQuery.list());
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return lists;
	}
	
	private List<StatisticsTotalEntity> QueryBy(List list) {
		List<StatisticsTotalEntity> lists = new ArrayList<StatisticsTotalEntity>();
		for (int i = 0; i < list.size(); i++) {
			StatisticsTotalEntity ste = new StatisticsTotalEntity();
			Object[] row = (Object[]) list.get(i);
			if(row[3]==null||row[3].toString().equals("")||row[5]==null||row[5].toString().equals("")){
				continue;
			}
			ste.setId(row[0].toString());
			ste.setGrabchannel(row[1].toString());
			ste.setGrabdate(row[2].toString());
			ste.setFromCity(row[3].toString());
			ste.setFromCityName(row[4].toString());
			ste.setToCity(row[5].toString());
			ste.setToCityName(row[6].toString());
			if (row[7] == null) {
				ste.setMinTime(0l);
			} else {
				ste.setMinTime(Long.parseLong(row[7].toString()));
			}
			if(row[8]==null){
				ste.setMaxTime(0l);
			}else {
				ste.setMaxTime(Long.parseLong(row[8].toString()));
			}
			if(row[9]==null){
				ste.setTotal(0l);
			}else {
				ste.setTotal(Long.parseLong(row[9].toString()));
			}
			if(row[10]==null){
				ste.setSuccessNum(0l);
			}else {
				ste.setSuccessNum(Long.parseLong(row[10].toString()));
			}
			if(row[11]==null){
				ste.setFailNum(0l);
			}else {
				ste.setFailNum(Long.parseLong(row[11].toString()));
			}
			if(row[12]==null){
				ste.setActualNum(0l);
			}else {
				ste.setActualNum(Long.parseLong(row[12].toString()));
			}
			if(row[13]==null){
				ste.setStatus(-10l);
			}else {
				ste.setStatus(Long.parseLong(row[13].toString()));
			}
			ste.setGrabchannelID(Long.parseLong(row[14].toString()));
			if(row[15]==null){
				ste.setAllbyteLength(0l);
			}else {
				ste.setAllbyteLength(Long.parseLong(row[15].toString()));
			}
			if(row[16]==null){
				ste.setSourceDataSize(0l);
			}else {
				ste.setSourceDataSize(Long.parseLong(row[16].toString()));
			}
			if(row[17]==null){
				ste.setStartTime("2000-01-01 13:13:13");
			}else{
				ste.setStartTime(row[17].toString().split("\\.")[0]);
			}
			if(row[18]==null){
				ste.setWaiting(0l);
			}else {
				ste.setWaiting(Long.parseLong(row[18].toString()));
			}
			ste.setStarting(0l);

			lists.add(ste);
		}
		return lists;
	}
	
	//引擎点击总数使用 getCountByDateAndChannel_2
	
	public int getCountByDateAndChannel_2(String grabdate, String grabchannelID) {
//		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//		String time=df.format(grabdate);
//		String hql="from StatisticsTotalEntity a where to_char(a.grabdate,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		String hql="from StatisticsTotalEntity a where date_format(a.grabdate,'%Y-%m-%d') = '"+grabdate+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		hql+=" order by fromCityName,toCityName";
		List<StatisticsTotalEntity> list = new ArrayList<StatisticsTotalEntity>();
		list=this.find(hql,list.toArray(),StatisticsTotalEntity.class);
		return list.size();
	}
	
	//total 失败信息统计
	public int getTotalCountByDateAndChannel(Date grabdate, String grabchannelID,String status,String fromCity,String toCity) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
		Long statuNum=Long.parseLong(status);
//		String hql="from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		String hql="from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		hql+=" and a.status = '"+status+"'  and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flightDate,fromCityName,toCityName";
		List<TaskQueueLogEntity> list = new ArrayList<TaskQueueLogEntity>();
		list=this.find(hql,list.toArray(),TaskQueueLogEntity.class);
		return list.size();
	}
	//total fail 
	public int getTotalAndFailCountByDateAndChannel(Date grabdate, String grabchannelID,String fromCity,String toCity) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
//		Long statuNum=Long.parseLong(status);
//		String hql="from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		String hql="from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		String status="3";
		hql+=" and a.status <'"+status+"'  and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flightDate,fromCityName,toCityName";
		List<TaskQueueLogEntity> list = new ArrayList<TaskQueueLogEntity>();
		list=this.find(hql,list.toArray(),TaskQueueLogEntity.class);
		return list.size();
	}
	// 182
	public List<TaskQueueLogEntity> getTotalAndFailRecordByDateAndChannel(
			Date grabdate, String grabchannelID,String fromCity,String toCity,int page,int pagesize) {
		//引擎统计中的时间  只有年月日，所以查失败详细信息时，时间只能通过模糊查询
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
//		String hql = "from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		String hql = "from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID= "+Long.parseLong(grabchannelID);
		String status="3";
//		Long statuNum=Long.parseLong(status);
		hql+=" and a.status < '"+status+"' and a.fromCity='"+fromCity+"' and a.toCity='"+toCity+"' order by flightDate,fromCityName,toCityName";
		DataPage<TaskQueueLogEntity> pageNum = find(hql, new Object[]{}, page, pagesize,TaskQueueLogEntity.class);
		List<TaskQueueLogEntity> lists =pageNum.getPageData();
		return lists;
	}
	
	//引擎统计使用
	@Override
	public int getCountByDateAndChannel(Date grabdate, String grabchannelID,String status) {
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
		String time=df.format(grabdate);
		Long statuNum=Long.parseLong(status);
//		String hql="from TaskQueueLogEntity a where to_char(a.createTime,'yyyy-MM-dd') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		String hql="from TaskQueueLogEntity a where date_format(a.createTime,'%Y-%m-%d') = '"+time+"' and a.grabchannelID ='"+Long.parseLong(grabchannelID)+"'";
		hql+=" and a.status = '"+status+"' order by flightDate,fromCityName,toCityName";
		List<TaskQueueLogEntity> list = new ArrayList<TaskQueueLogEntity>();
		list=this.find(hql,list.toArray(),TaskQueueLogEntity.class);
		return list.size();
	}

	/**
	 * 处理数据持久化
	 * @ by 抓取统计
	 */	
	@Override
	public List<TaskQueueLogEntity> getAllDatasByGrabDate(Date date,Date endGrabDate) {
		List<TaskQueueLogEntity> list = new ArrayList<TaskQueueLogEntity>();
		//hibernate 查询
		StringBuffer sbf=new StringBuffer("from TaskQueueLogEntity a where 1=1 ");
		List<Object> params = new ArrayList<Object>();
		
		if(date !=null ){
			Date nextDates=DateUtils.StringToDate("yyyy-MM-dd HH:mm:ss", DateUtils.getDateTimeAfter(DateUtils.dateToStr(date, "yyyy-MM-dd HH:mm:ss"),-1));
			sbf.append(" and a.createTime >= ? ");
			sbf.append(" and a.createTime <= ? ");
//			params.add(nextDates);
			params.add(date);
			params.add(endGrabDate);
		}
		list=this.find(sbf.toString(),params.toArray(),TaskQueueLogEntity.class);
		
		//mysql 查询
		/*StringBuffer sbf=new StringBuffer("select * from CRAWL_TASK_QUEUE_LOG where 1=1 ");
		if(date !=null ){
			String dateStr=DateUtils.dateToStr(date, "yyyy-MM-dd HH:mm:ss");
			sbf.append(" and create_date >= STR_TO_DATE('"+dateStr+"','%Y-%m-%d %H:%i:%s') ");
		}
		if(endGrabDate !=null){
			String endGrabDateStr=DateUtils.dateToStr(endGrabDate, "yyyy-MM-dd HH:mm:ss");
			sbf.append("and create_date < STR_TO_DATE('"+endGrabDateStr+"','%Y-%m-%d %H:%i:%s')");
		}
		list=jdbctemp.queryForList(sbf.toString(), TaskQueueLogEntity.class);*/
		
		return list;
	}

}
